/* Copyright (C) Abu Rizal, 2009.
 * 
 * This file is part of QurText.
 * 
 * QurText is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * QurText is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with QurText. If not, see <http://www.gnu.org/licenses/>.
 */
package qurtext.client;

import java.io.Serializable;
import java.util.TreeMap;

@SuppressWarnings("serial")
public class ClientSection implements Serializable, Comparable<ClientSection>{
	public int sectionNo; 
	public int chapter; 
	public int verse; 
	public int endVerse;
	public TreeMap<Integer, ClientVerse> verses;
	public ClientSection() {
	}
	public ClientSection(int sectionNo, int chapter, int verse, int endVerse) {
		this.sectionNo = sectionNo;
		this.chapter = chapter;
		this.verse = verse;
		this.endVerse = endVerse;
	}
	@Override
	public boolean equals(Object obj) {
		if ( ! (obj instanceof ClientSection)) return false;
		ClientSection target = (ClientSection) obj;
		return 0==compareTo(target);
	}
	@Override
	public int hashCode() {
		return toString().hashCode();
	}
	@Override
	public String toString() {
		return ""+chapter+":"+verse;
	}
	@Override
	public int compareTo(ClientSection target) {
		if (target.chapter!=this.chapter) return this.chapter-target.chapter;
		return this.verse-target.verse;
	}
	
}
